package com.kucowka.store.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller(value = "autocompleteController")
@RequestMapping(value = "/autocomplete")
public class CityController {

	@RequestMapping(value = "/cities", method = RequestMethod.GET, headers = "Accept=*/*")
	public @ResponseBody
	Object testGet(@RequestParam(required = false) String term) {
		System.out.println("HTTP GET Cities prefix " + term);

		String[] cities = new String[]{"Warszawa", "Wrocaław"};

		return cities;
	}
}
